{{define "Title"}}KanBan{{end}}
{{define "Content"}}

<script type=text/javascript src="/js/calendar.js"></script>
<script type=text/javascript src="/js/tablestyle.js"></script>

<div class="container-fluid">
<form class="form-horizontal" action="/kanban" method="POST">
  <fieldset>
    <legend><b>KanBan</b></legend>
    {{if .error}}<div class="alert alert-error"><b>错误: </b>{{.error | html}}</div>
    {{end}}
    <div class="control-group">
      <label class="control-label">查询日期&nbsp;</label>
      <div class="control">
        <input class="input-large" id="fromdate" name="fromdate" onfocus="setday(this);" size="20">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">物料&nbsp;</label>
      <div class="control">
        <select id="item" name="item" onkeydown="clicka();">
          <option value="">
          {{range .items}}
            <option value="{{.Item | html}}">{{.Item | html}}  |  {{.Desc | html}}
          {{end}}
        </select>
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">查询</button>
    </div>
  </fieldset>
</form>
</div>

{{if .begindate}}
<div class="control-group">
  <label class="control-label">日期区间: &lt;<b>{{.begindate | html}}</b>&gt; - &lt;<b>{{.enddate | html}}</b>&gt;</label>
</div>
<div class="control-group">
  <label class="control-label">物料: <b>{{.item | html}}</b></label>
</div>
{{end}}

{{if .total_sta}}
<div class="content-box">
<table id="tbl_ls" border="1" cellspacing="0" cellpadding="0" style="font-size:100%">
  <thead>
    <tr>
      <th rowspan='1' style="text-align:center">站点</th>
      <th rowspan='1' style="text-align:center">投入</th>
      <th rowspan='1' style="text-align:center">产出</th>
      <th rowspan='1' style="text-align:center">在制</th>
      <th rowspan='1' style="text-align:center">不良</th>
      <th rowspan='1' style="text-align:center">F3</th>
      <th rowspan='1' style="text-align:center">F2</th>
      <th rowspan='1' style="text-align:center">F1</th>
      <th rowspan='1' style="text-align:center">P3</th>
      <th rowspan='1' style="text-align:center">P2</th>
      <th rowspan='1' style="text-align:center">P1</th>
      <th rowspan='1' style="text-align:center">P</th>
      <th rowspan='1' style="text-align:center">FPY</th>
      <th rowspan='1' style="text-align:center">RPY1</th>
      <th rowspan='1' style="text-align:center">RPY2</th>
      <th rowspan='1' style="text-align:center">RPY3</th>
      <th rowspan='1' style="text-align:center">RPY</th>
      <th rowspan='1' style="text-align:center">PY</th>
    </tr>
  </thead>
  <tbody id="group_one">
  {{$curitem := .item}}
  {{$curb := .begindate}}
  {{$curf := .enddate}}
  {{range .total_sta}}
  <tr>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Station | html}}</td>
    {{if gt .Input 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Input | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .Output 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Output | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .Inprocess 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/inprocdetail?nm={{.Inprocess | html}}&wo=All&st={{.Station | html}}&im={{$curitem | html}}">{{.Inprocess | html}}</a></td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .FailUnit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/infaildetail?nm={{.FailUnit | html}}&wo=All&st={{.Station | html}}&im={{$curitem | html}}">{{.FailUnit | html}}</a></td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .F3Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.F3Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .F2Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.F2Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .F1Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.F1Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .P3Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.P3Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .P2Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.P2Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .P1Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.P1Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .PUnit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.PUnit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.FpyYield | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.RpYield1 | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.RpYield2 | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.RpYield3 | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.RpYield | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.PyYield | html}}</td>
  </tr>
  {{end}}
  <tr>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.Station | html}}</td>
    {{if gt .totals.Input 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.Input | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.Output 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.Output | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.Inprocess 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/inprocdetail?nm={{.totals.Inprocess | html}}&wo=All&st=All&im={{$curitem | html}}">{{.totals.Inprocess | html}}</a></td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.FailUnit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/infaildetail?nm={{.totals.FailUnit | html}}&wo=All&st=All&im={{$curitem | html}}">{{.totals.FailUnit | html}}</a></td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.F3Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.F3Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.F2Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.F2Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.F1Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.F1Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.P3Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.P3Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.P2Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.P2Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.P1Unit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.P1Unit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    {{if gt .totals.PUnit 0}}
      <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.PUnit | html}}</td>
    {{else}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
    {{end}}
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.FpyYield | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.RpYield1 | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.RpYield2 | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.RpYield3 | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.RpYield | html}}</td>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.totals.PyYield | html}}</td>
  </tr>
  </tbody>
</table>
</div>
{{end}}

{{end}}